<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main2" />
    <g:set var="entityName" value="${message(code: 'asset?.label', default: 'Company')}" />
    <title>编辑资产信息</title>
</head>

<body>
    <div class="main-body">
        <div class="page-wrapper">
            <!-- Page-header start -->
            <div class="page-header">
                <div class="page-header-title">
                    <h4>编辑资产信息</h4>
                </div>

                <div class="page-header-breadcrumb">
                    <ul class="breadcrumb-title">
                        <li class="breadcrumb-item">
                            <a href="/salesDashboard/index">
                                <i class="icofont icofont-home"></i>
                            </a>
                        </li>
                        <li class="breadcrumb-item">
                            <g:link controller="asset" action="index">资产信息</g:link>
                        </li>
                        <li class="breadcrumb-item">编辑资产信息</li>
                    </ul>
                </div>
            </div>
            <!-- Page-header end -->
            <!-- Page-body start -->
            <div class="page-body">
                <g:if test="${flash.message}">
                    <div class="message alert alert-info" role="status">${flash.message}
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">×</span></button>
                    </div>
                </g:if>
                <g:hasErrors bean="${this.asset}">
                    <ul class="errors" role="alert">
                        <g:eachError bean="${this.asset}" var="error">
                            <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>>
                                <g:message error="${error}" />
                            </li>
                        </g:eachError>
                    </ul>
                </g:hasErrors>
                <!-- Hover table card start -->
                <div class="card">
                    <div class="card-header">
                        <h5>编辑资产信息</h5>

                        <div class="card-header-right">
                            <i class="icofont icofont-rounded-down"></i>
                        </div>
                    </div>

                    <div class="card-block">
                        <g:form resource="${this.asset}" method="PUT">
                            <div class="form-group row">
                                <label class="col-md-2 col-form-label is-required">资产名称</label>

                                <div class="col-md-3">
                                    <g:textField class="form-control" name="name" id="name" value="${this.asset?.name}" />
                                </div>
                                <label class="col-md-2 col-form-label is-required">序列号</label>

                                <div class="col-md-3">
                                    <g:textField class="form-control" name="code" id="code" value="${this.asset?.code}" />
                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label is-required">资产状态</label>
                                <div class="col-md-3">
                                    <g:select class="form-control" name="status" value="${this.asset?.status?.id}" id="status" optionValue="name" optionKey="id" from="${com.next.AssetStatus.list()}" noSelection="${['': '请选择']}" />
                                </div>

                                <label class="col-md-2 col-form-label is-required">产品</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="product" value="${this.asset?.product?.id}" id="product" optionValue="name" optionKey="id" from="${com.next.Product.findAllByActive(true)}" noSelection="${['': '请选择']}" />
                                </div>

                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label is-required">客户</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="account.id" value="${this.asset?.account?.id}" optionValue="account" optionKey="accountId" from="${com.next.AccountTeam.findAllByUser(this?.user)}" noSelection="${['': '请选择']}" />
                                </div>
                                <label class="col-md-2 col-form-label">联系人</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="contact.id" value="${this.asset?.contact?.id}" optionValue="contact" optionKey="contactId" from="${com.next.ContactTeam.findAllByUser(this?.user)}" noSelection="${['': '请选择']}" />
                                </div>
                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label">合同</label>

                                <div class="col-md-3">
                                    <g:select class="form-control" name="contract.id" value="${this.asset?.contract?.id}" optionKey="id" from="${com.next.Contract.list()}" noSelection="${['': '请选择']}" />
                                </div>

                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label is-required">数量</label>

                                <div class="col-md-3">
                                    <g:field type="number" class="form-control" name="quantity" id="quantity" value="${this.asset?.quantity}" />
                                </div>
                                <label class="col-md-2 col-form-label">采购时间</label>

                                <div class="col-md-3 datePicker">
                                    %{-- <g:datePicker precision="day" name="purchaseDate" value="${this.asset?.purchaseDate}" /> --}%
                                    <div class="input-group ">
                                        <input type="text" valctrl="purchaseDate" value="${this.asset?.purchaseDate}" class="form-control form_date">
                                        <input type="hidden" id="purchaseDate" name="purchaseDate" value="date.struct">
                                        <input type="hidden" id="purchaseDate_day" name="purchaseDate_day" value="">
                                        <input type="hidden" id="purchaseDate_month" name="purchaseDate_month" value="">
                                        <input type="hidden" id="purchaseDate_year" name="purchaseDate_year" value="">
                                    </div>
                                </div>
                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label">安装时间</label>

                                <div class="col-md-3 datePicker">
                                    <div class="input-group ">
                                        <input type="text" valctrl="installDate" value="${this.asset?.installDate}" class="form-control form_date">
                                        <input type="hidden" id="installDate" name="installDate" value="date.struct">
                                        <input type="hidden" id="installDate_day" name="installDate_day" value="">
                                        <input type="hidden" id="installDate_month" name="installDate_month" value="">
                                        <input type="hidden" id="installDate_year" name="installDate_year" value="">
                                    </div>

                                </div>
                                <label class="col-md-2 col-form-label">停用时间</label>

                                <div class="col-md-3 datePicker">
                                    <div class="input-group ">
                                        <input type="text" valctrl="usageEndDate" value="${this.asset?.usageEndDate}" class="form-control form_date">
                                        <input type="hidden" id="usageEndDate" name="usageEndDate" value="date.struct">
                                        <input type="hidden" id="usageEndDate_day" name="usageEndDate_day" value="">
                                        <input type="hidden" id="usageEndDate_month" name="usageEndDate_month" value="">
                                        <input type="hidden" id="usageEndDate_year" name="usageEndDate_year" value="">
                                    </div>
                                </div>
                            </div>

                            <div class="form-group row">

                                <label class="col-md-2 col-form-label">竞争对手的设备</label>
                                <div class="col-md-3 border-checkbox-section">
                                    <div class="border-checkbox-group border-checkbox-group-primary form-control-static">
                                        <g:checkBox class="border-checkbox" name="competitorAsset" id="checkbox0" value="${this.asset?.competitorAsset}" />
                                        <label class="border-checkbox-label" for="checkbox0"></label>
                                    </div>

                                </div>
                            </div>

                            <div class="form-group row">
                                <label class="col-md-2 col-form-label is-required">备注</label>

                                <div class="col-md-8">
                                    <g:textArea rows="3" class="form-control" name="description" id="description" value="${this.asset?.description}" />
                                </div>

                            </div>

                            <div class="form-group row">
                                <div class="col-md-12">
                                    <g:submitButton class="btn btn-info" name="update" value="保存" />
                                </div>
                            </div>
                        </g:form>
                    </div>

                </div>
            </div>
        </div>
</body>

</html>
